package lab02.Test11;

/**
 * Created by Administrator on 2017/10/21.
 */
public class Rectangle implements Printx {
    //属性：长、宽
    //行为：面积、周长
    double length;
    double width;

    Rectangle(double a, double b) {
        length = a;
        width = b;
    }

    @Override
    public void printMyWay() {
        System.out.println("矩形长:" + length);
        System.out.println("矩形宽：" + width);
        System.out.println("面积为：" + length * width);
        System.out.println("周长为：" + 2 * (length + width));
    }

    public static void main(String[] args) {
        Rectangle S = new Rectangle(2,6);
        System.out.println(S.getClass().getName()+"矩形");
        S.printMyWay();
    }
}